<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>管理中心 - 商品列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/Admin/Styles/general.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Admin/Styles/main.css" rel="stylesheet" type="text/css" />

    <link href="/Public/bootstrap/css/docs.min.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/Public/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<h1>
    <?php if($_page_btn_name): ?>
    <span class="action-span"><a href="<?php echo $_page_btn_link; ?>"><?php echo $_page_btn_name; ?></a></span>
    <?php endif; ?>
<span class="action-span1"><a href="<?php echo U('');?>">管理中心</a></span>
<span id="search_id" class="action-span1"> - <?php echo $_page_title; ?> </span>
<div style="clear:both"></div>
</h1>

<div class="main-div">
    <form name="main_form" method="POST" action="/index.php/Admin/Role/add.html" enctype="multipart/form-data">
        <table cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="label3" style="width: 45%">角色名称：</td>
                <td>
                    <input  type="text" name="role_name" value="" />
                </td>
            </tr>
            <tr>
                <td class="label3">权限列表：</td>
                <td>
                   <?php if(is_array($priData)): foreach($priData as $k=>$v): echo str_repeat('-',8*$v['level'])?>
                       <input  level_id="<?php echo ($v["level"]); ?>" type="checkbox" name="pri_id[]" value="<?php echo ($v["id"]); ?>"/>
                       <?php echo ($v["pri_name"]); ?>
                       <br/><?php endforeach; endif; ?>
                </td>
            </tr>
            <tr>
                <td colspan="99" align="center">
                    <input type="submit" class="button" value=" 确定 " />
                    <input type="reset" class="button" value=" 重置 " />
                </td>
            </tr>
        </table>
    </form>
</div>


<script>
    $(":checkbox").click(function () {
        var tmp_level_id = level_id = $(this).attr('level_id');
        if($(this).prop('checked')){
            $(this).nextAll(":checkbox").each(function (k,v) {
                if($(v).attr("level_id") >level_id)
                $(v).prop("checked","checked");
                else
                    return false;
            });
            $(this).prevAll(":checkbox").each(function (k,v) {
                if($(v).attr("level_id")<tmp_level_id){
                    $(v).prop("checked","checked");
                    tmp_level_id--;
                }
            });
        }else{
            $(this).nextAll(":checkbox").each(function (k,v) {
               if($(v).attr('level_id')>level_id)
                   $(v).removeAttr("checked");
                   else
                       return false;
            })
        }
    });
</script>
<div id="footer">
    共执行 9 个查询，用时 0.025161 秒，Gzip 已禁用，内存占用 3.258 MB<br />
    版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。
</div>
</body>
</html>